package com.bw.myincome.service.impl;

import com.bw.myincome.domain.Order;
import com.bw.myincome.mapper.MyInconmeMapper;
import com.bw.myincome.service.MyInconmeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MyInconmeServiceImpl implements MyInconmeService {
    @Autowired
    private MyInconmeMapper myInconmeMapper;

    @Override
    public List<Order> getMyIncomeList(Integer id) {
        return myInconmeMapper.getMyIncomeList(id);
    }

    @Override
    public Order getTotal(Integer id) {
        return myInconmeMapper.getTotal(id);
    }

    @Override
    public List<Order> getOrderList(Order order) {
        //处理年份和月份
        String month = order.getMonth();
        //截取0-4
        if(month.length()>4){
            order.setYear(month.substring(0,4));
            order.setMonth(month.substring(5,month.length()));
        }
        System.out.println(order);
        return myInconmeMapper.getOrderList(order.getDoctorId(),order.getMonth(),order.getYear());
    }

    @Override
    public Order getOrderDetails(Integer id, Integer orderId) {
        return myInconmeMapper.getOrderDetails(id,orderId);
    }

    @Override
    public List<Order> getOrderList2(Order order) {

        return null;
    }
}
